let mySwiper = new Swiper('.swiper1', {
    spaceBetween: 30,
    centeredSlides: true,
    autoplay: {
        delay: 2500,
        disableOnInteraction: false,
    },
    pagination: {
        el: ".swiper-pagination",
        clickable: true,
    },
    navigation: {
        nextEl: ".swiper-button-next",
        prevEl: ".swiper-button-prev",
    },
    loop: true
});
$('.swiper1').addEventListener('mouseover', function() {
    mySwiper.autoplay.stop();
    $('.swiper-button-prev').style.display = 'block'
    $('.swiper-button-next').style.display = 'block'

})
$('.swiper1').addEventListener('mouseout', function() {
    mySwiper.autoplay.start();
    $('.swiper-button-prev').style.display = 'none'
    $('.swiper-button-next').style.display = 'none'
})

let pathName = ''
$a('.ul-fa li a').forEach(function(dom) {
    dom.addEventListener('mouseover', function() {
        dom.style.backgroundColor = 'blue'

        /* 获取图片的路径 */
        let path = dom.children[0].src
            // console.log(path);

        /* 查找最后一个/的位置 */
        let index1 = path.lastIndexOf('/')
        let index2 = path.lastIndexOf('.')
            /* 截取路径 */
        pathName = path.slice(index1 + 1, index2)
            // console.log(pathName);

        /* 设置图片路径 */
        dom.children[0].src = `../../assets/imgs/${pathName}-c.svg`
    })
    dom.addEventListener('mouseout', function() {
        dom.style.backgroundColor = ''
        dom.children[0].src = `../../assets/imgs/${pathName}.svg`
    })
})

let mySwiper2 = new Swiper('.swiper2', {

    autoplay: {
        delay: 3000,
        stopOnLastSlide: false,
        disableOnInteraction: false,
    },
    loop: true,
    effect: "fade"
});






























// /* 回到顶部隐藏 */
// window.onscroll = function() {
//     // 获取进度条的位置
//     let jdtheight = document.documentElement.scrollTop || document.body.scrollTop
//     if (jdtheight >= 600) {
//         bt1.style.display = 'block'
//     }
//     if (jdtheight <= 5000) {
//         bt1.style.display = 'none'

//     }
// }

// function toTop() {
//     // console.log('111');
//     window.scrollTo({
//         top: 0,
//         behavior: 'smooth'

//     });


// }



























/* 回到顶部 */
/* 给window注册滚动事件 */
window.addEventListener('scroll', function() {
        if (this.window.scrollY >= 600) {
            $('.totop').style.display = 'block'
        } else {
            $('.totop').style.display = 'none'
        }


    })
    /* 注册点击事件 */
$('.totop').addEventListener('click', function() {
    /*这是一个对象 */
    window.scrollTo({
        top: 0,
        behavior: 'smooth'

    })
})